package by.grsu.epam.domain.user.impl;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.OneToMany;

import by.grsu.epam.domain.account.Account;
import by.grsu.epam.domain.user.User;

@Entity
public class Subscriber extends User {
	
	private List<Account> accounts;
	
	public Subscriber() {
		super();
	}
	
	@OneToMany(targetEntity = Account.class, mappedBy = "subscriber",
			cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public List<Account> getAccounts() {
		return accounts;
	}

	public void setAccounts(List<Account> accounts) {
		this.accounts = accounts;
	}
}
